from dotenv import load_dotenv
import os

load_dotenv()  # 加载.env文件

class Settings:
    SECRET_KEY: str = os.getenv("SECRET_KEY", "fallback_key")
    ALGORITHM: str = os.getenv("ALGORITHM", "HS256")
    ACCESS_TOKEN_EXPIRE_MINUTES: int = 120  # 修改为2小时（120分钟）
    CAPTCHA_EXPIRE_MINUTES: int = 5
    # 数据库配置
    DB_HOST: str = os.getenv("DB_HOST")
    DB_PORT= os.getenv("DB_PORT")
    DB_NAME: str = os.getenv("DB_NAME")
    DB_USER: str = os.getenv("DB_USER")
    DB_PASSWORD: str = os.getenv("DB_PASSWORD")
    
    # Redis配置
    REDIS_HOST: str = os.getenv("REDIS_HOST")
    REDIS_PORT= os.getenv("REDIS_PORT")
    REDIS_PASSWORD: str = os.getenv("REDIS_PASSWORD")
    
    # 七牛云配置
    QINIU_AK: str = os.getenv("QINIU_AK")
    QINIU_SK: str = os.getenv("QINIU_SK")
    QINIU_BUCKET: str = os.getenv("QINIU_BUCKET")
    QINIU_DOMAIN: str = os.getenv("QINIU_DOMAIN")
    
    class Config:
        case_sensitive = True

settings = Settings()
